from pydantic import BaseModel
from typing import Optional

class UniAccountBase(BaseModel):
    groupid: int
    name: str
    description: str
    default_acid: int
    rank: Optional[int]
    title_initial: str
    createtime: int
    logo: str
    qrcode: str
    create_uid: int

class UniAccountCreate(UniAccountBase):
    pass

class UniAccountUpdate(BaseModel):
    groupid: Optional[int]
    name: Optional[str]
    description: Optional[str]
    default_acid: Optional[int]
    rank: Optional[int]
    title_initial: Optional[str]
    logo: Optional[str]
    qrcode: Optional[str]
    create_uid: Optional[int]

class UniAccountRead(UniAccountBase):
    uniacid: int

    class Config:
        from_attributes = True

class UniAccountExtraModulesBase(BaseModel):
    uniacid: int
    modules: str

class UniAccountExtraModulesCreate(UniAccountExtraModulesBase):
    pass

class UniAccountExtraModulesUpdate(BaseModel):
    modules: Optional[str]

class UniAccountExtraModulesRead(UniAccountExtraModulesBase):
    id: int

    class Config:
        from_attributes = True

class UniAccountGroupBase(BaseModel):
    uniacid: int
    groupid: int

class UniAccountGroupCreate(UniAccountGroupBase):
    pass

class UniAccountGroupUpdate(BaseModel):
    groupid: Optional[int]

class UniAccountGroupRead(UniAccountGroupBase):
    id: int

    class Config:
        from_attributes = True

class UniAccountMenusBase(BaseModel):
    uniacid: int
    menuid: int
    type: int
    title: str
    sex: int
    group_id: int
    client_platform_type: int
    area: str
    data: str
    status: int
    createtime: int
    isdeleted: int

class UniAccountMenusCreate(UniAccountMenusBase):
    pass

class UniAccountMenusUpdate(BaseModel):
    type: Optional[int]
    title: Optional[str]
    sex: Optional[int]
    group_id: Optional[int]
    client_platform_type: Optional[int]
    area: Optional[str]
    data: Optional[str]
    status: Optional[int]
    isdeleted: Optional[int]

class UniAccountMenusRead(UniAccountMenusBase):
    id: int

    class Config:
        from_attributes = True

class UniAccountModulesBase(BaseModel):
    uniacid: int
    module: str
    enabled: int
    settings: str
    shortcut: int
    displayorder: int

class UniAccountModulesCreate(UniAccountModulesBase):
    pass

class UniAccountModulesUpdate(BaseModel):
    module: Optional[str]
    enabled: Optional[int]
    settings: Optional[str]
    shortcut: Optional[int]
    displayorder: Optional[int]

class UniAccountModulesRead(UniAccountModulesBase):
    id: int

    class Config:
        from_attributes = True

class UniAccountModulesShortcutBase(BaseModel):
    title: str
    url: str
    icon: str
    uniacid: int
    version_id: int
    module_name: str

class UniAccountModulesShortcutCreate(UniAccountModulesShortcutBase):
    pass

class UniAccountModulesShortcutUpdate(BaseModel):
    title: Optional[str]
    url: Optional[str]
    icon: Optional[str]
    version_id: Optional[int]
    module_name: Optional[str]

class UniAccountModulesShortcutRead(UniAccountModulesShortcutBase):
    id: int

    class Config:
        from_attributes = True

class UniAccountUsersBase(BaseModel):
    uniacid: int
    uid: int
    role: str
    rank: int

class UniAccountUsersCreate(UniAccountUsersBase):
    pass

class UniAccountUsersUpdate(BaseModel):
    role: Optional[str]
    rank: Optional[int]

class UniAccountUsersRead(UniAccountUsersBase):
    id: int

    class Config:
        from_attributes = True

class UniGroupBase(BaseModel):
    owner_uid: int
    name: str
    modules: str
    templates: str
    uniacid: int
    uid: int

class UniGroupCreate(UniGroupBase):
    pass

class UniGroupUpdate(BaseModel):
    name: Optional[str]
    modules: Optional[str]
    templates: Optional[str]
    owner_uid: Optional[int]
    uid: Optional[int]

class UniGroupRead(UniGroupBase):
    id: int

    class Config:
        from_attributes = True

class UniLinkUniacidBase(BaseModel):
    uniacid: int
    link_uniacid: int
    version_id: int
    module_name: str

class UniLinkUniacidCreate(UniLinkUniacidBase):
    pass

class UniLinkUniacidUpdate(BaseModel):
    link_uniacid: Optional[int]
    version_id: Optional[int]
    module_name: Optional[str]

class UniLinkUniacidRead(UniLinkUniacidBase):
    id: int

    class Config:
        from_attributes = True

class UniModulesBase(BaseModel):
    uniacid: int
    module_name: str

class UniModulesCreate(UniModulesBase):
    pass

class UniModulesUpdate(BaseModel):
    module_name: Optional[str]

class UniModulesRead(UniModulesBase):
    id: int

    class Config:
        from_attributes = True

class UniVerifycodeBase(BaseModel):
    uniacid: int
    receiver: str
    verifycode: str
    total: int
    createtime: int
    failed_count: Optional[int]

class UniVerifycodeCreate(UniVerifycodeBase):
    pass

class UniVerifycodeUpdate(BaseModel):
    verifycode: Optional[str]
    total: Optional[int]
    failed_count: Optional[int]

class UniVerifycodeRead(UniVerifycodeBase):
    id: int

    class Config:
        from_attributes = True

class UniSettingsBase(BaseModel):
    uniacid: int
    passport: str
    oauth: str
    jsauth_acid: int
    notify: str
    creditnames: str
    creditbehaviors: str
    welcome: str
    default: str
    default_message: str
    payment: str
    stat: str
    default_site: Optional[int]
    sync: int
    recharge: str
    tplnotice: str
    grouplevel: int
    mcplugin: str
    exchange_enable: int
    coupon_type: int
    menuset: str
    statistics: str
    bind_domain: str
    comment_status: int
    reply_setting: int
    default_module: str
    attachment_limit: int
    attachment_size: str
    sync_member: int
    remote: str

class UniSettingsCreate(UniSettingsBase):
    pass

class UniSettingsUpdate(BaseModel):
    passport: Optional[str]
    oauth: Optional[str]
    jsauth_acid: Optional[int]
    notify: Optional[str]
    creditnames: Optional[str]
    creditbehaviors: Optional[str]
    welcome: Optional[str]
    default: Optional[str]
    default_message: Optional[str]
    payment: Optional[str]
    stat: Optional[str]
    default_site: Optional[int]
    sync: Optional[int]
    recharge: Optional[str]
    tplnotice: Optional[str]
    grouplevel: Optional[int]
    mcplugin: Optional[str]
    exchange_enable: Optional[int]
    coupon_type: Optional[int]
    menuset: Optional[str]
    statistics: Optional[str]
    bind_domain: Optional[str]
    comment_status: Optional[int]
    reply_setting: Optional[int]
    default_module: Optional[str]
    attachment_limit: Optional[int]
    attachment_size: Optional[str]
    sync_member: Optional[int]
    remote: Optional[str]

class UniSettingsRead(UniSettingsBase):
    class Config:
        from_attributes = True 